<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1.0,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0"/>
    <title></title>
    <link rel="stylesheet" href="/css/common.css"/>

</head>
<body>
<div>
    <div><img width="100%" src="/img/adv.png" alt=""/></div>
    <div class="pg2-box">
        <div class="p2-h1">我的性格是怎样的</div>
        <div class="p2-h2">
            <span class="p1">￥<?php echo $res['present_price']?>元</span>
            <span class="p2"><del>￥<?php echo $res['original_price']?>元</del></span>
        </div>
    </div>

    <div class="pay-tt1">请选择支付方式</div>
    <div class="tab-ct">
        <div class="pay-tab">
            <span ><img width="30px" src="../img/weixin.png" alt=""/> <span>&nbsp;微信支付</span></span>
            <span><img width="20px" src="../img/gou.png" alt=""/></span>
        </div>
    </div>
    <br/>
    <br/>
    <br/>
    <div class="pay-btn" onclick="callpay()">立即支付</div>
    <div class="btn-tip"><a href="showanaly">已支付发现幸福密码</a></div>
</div>
</body>
<script src="/lib/js/jquery-1.9.0.min.js"></script>
</html>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script type="text/javascript">  
    //调用微信JS api 支付
    function jsApiCall()
    {
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest',
            <?php echo $jsApiParameters; ?>,
            function(res){
                if(res.err_msg == "get_brand_wcpay_request:ok" ) {

                 alert(res.err_code+res.err_desc+res.err_msg);


                }
                // WeixinJSBridge.log(res.err_msg);
                // alert(res.err_code+res.err_desc+res.err_msg);
            }
        );
    }

    
    function callpay()
    {
        if (typeof WeixinJSBridge == "undefined"){
            if( document.addEventListener ){
                document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
            }else if (document.attachEvent){
                document.attachEvent('WeixinJSBridgeReady', jsApiCall); 
                document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
            }
        }else{
            jsApiCall();
        }
    }





</script>